export default {
	getDate:(n)=>{
	 let date = date || new Date()
	 let timestamp
	 let newDate
	 if (!(date instanceof Date)) {
		date = new Date(date.replace(/-/g, '/'))
	}
	timestamp = date.getTime()
	newDate = new Date(timestamp - n * 24 * 3600 * 1000)
	let month = newDate.getMonth() + 1
	month = month.toString().length === 1 ? '0' + month : month
	let day = newDate.getDate().toString().length === 1 ? '0' + newDate.getDate() : newDate.getDate()
	const time = [newDate.getFullYear(), month, day].join('-')
		return time
	},
	// 获取每个月一号
	 getStartDate() {
		let myDate = new Date();
		let tYear = myDate.getFullYear()
		let tMonth = myDate.getMonth()
		tMonth = this.doHandleZero(tMonth + 1)
		return tYear + "-" + tMonth + "-01"
	},
	// 补零函数
	doHandleZero(zero) {
		let date = zero;
		if (zero.toString().length == 1) {
				date = "0" + zero;
		}
		return date;
	},
}